﻿//PlazaColumn.cs
//Copyright (c) 2013 StockSharp LLC, all rights reserved.
//This code module is part of StockSharp library.
//This code is licensed under the GNU GENERAL PUBLIC LICENSE Version 3.
//See the file License.txt for the license details.
//More info on: http://stocksharp.com

namespace StockSharp.Plaza.Metadata
{
	using System;

	using Ecng.Common;
	using Ecng.Serialization;

	/// <summary>
	/// Колонка таблицы с метаданными.
	/// </summary>
	[EntityFactory(typeof(UnitializedEntityFactory<PlazaColumn>))]
	[TypeSchemaFactory(SearchBy.Properties, VisibleScopes.Both)]
	[Ignore(FieldName = "IsDisposed")]
	public class PlazaColumn
	{
		internal PlazaColumn(string tableName, string name, PlazaType plazaType, bool isMandatory = true)
		{
			if (tableName == null)
				throw new ArgumentNullException("tableName");

			if (name.IsEmpty())
				throw new ArgumentNullException("name");

			TableName = tableName;
			IsMandatory = isMandatory;
			Name = name;
			PlazaType = plazaType;
			Index = -1;
		}
		
		internal bool IsMandatory { get; private set; }

		internal int Index { get; set; }

		internal string TableName { get; private set; }

		/// <summary>
		/// Название колонки.
		/// </summary>
		public string Name { get; private set; }

		/// <summary>
		/// Тип колонки (Plaza).
		/// </summary>
		public PlazaType PlazaType { get; private set; }

		/// <summary>
		/// Получить строковое представление.
		/// </summary>
		/// <returns>Строковое представление.</returns>
		public override string ToString()
		{
			return Name;
		}
	}
}